External APIs

Build full-stack applications by calling external APIs with environment variables.

You can call external services in your v0 prototypes by storing access keys as environment variables. This works for both third-party and your own APIs.

Adding API keys

  1. Click Vars on the chat sidebar
  2. Click Add to create a new environment variable
  3. Select the environments where the variable should be available
  4. Enter the Name (e.g. API_KEY) and Value for your key
  5. Click Add Variables to save
Environment variables panel

Environments

When adding a variable, you can choose which environments it applies to:

Add environment variables modal

This lets you use different API keys for testing vs production, or enable features only in certain environments.

EnvironmentDescription
ProductionApplied to your live, published app
PreviewApplied to preview deployments (non-production branches)
DevelopmentUsed when running your project locally

Environment variables are encrypted and stored securely on Vercel. Once added, you can instruct v0 to use them in your API calls.

Learn more about environment variables